<template>
  <div>
    <form>
      <label>姓名：</label>
      <input v-model="name" type="text"><br><br>

      <label>年龄：</label>
      <input v-model.number="age" type="number"><br><br>

      <label>身高：</label>
      <input v-model.number="height" type="number">(米)<br><br>

      <label>体重：</label>
      <input v-model.number="weight" type="number">(公斤)<br><br>

      <label>病史：</label>
      <input v-model="history" type="text"><br><br>

      <button @click="add">诊断</button>
    </form>

    <p>患者 的诊断结果：{{ result }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      name: '',
      age: '',
      height: '',
      weight: '',
      history: '',
      result: '',
    }
  },
  methods: {
    add() {
      const res = this.weight / this.height ^ 2
      console.log(res)
      if (res < '24.9' && res > '18.5') {
        this.result = '健康'
      } else {
        this.result = '不健康'
      }
    }
  }
}
</script>
